﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/page/back/common.jsp"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
		<link rel="stylesheet" href="${ctx}/static/css/font-awesome.css" />
		<link rel="stylesheet" href="${ctx}/static/css/Buy_print.css" />
		<script type="text/javascript" src="${ctx}/static/js/jquery-1.11.1.min.js" ></script>
		<script src="${ctx}/static/js/wx.js"></script>
		<link rel="stylesheet"
			  href="http://cdn.bootcss.com/weui/1.1.1/style/weui.min.css">
		<link rel="stylesheet"
			  href="http://cdn.bootcss.com/jquery-weui/1.0.1/css/jquery-weui.min.css">
		<title>确认订单信息</title>
	</head>
	<script type="text/javascript">


       var ctx="${ctx}";

				$(".modelinput").css({"background-color":"#0093DD","color":"#fff"}).siblings(".modelinput").css({"background-color":"#ddd","color":"#000"});


				$(".kindsInput").css({"background-color":"#0093DD","color":"#fff"}).siblings(".kindsInput").css({"background-color":"#ddd","color":"#000"})


	</script>
	<body>
		<header>
			<a href="Print_setup_list.html" class="content"><i class="icon-angle-left"></i>确认订单信息</a>
		</header>
		<article>
			<img src="${ctx}/static/img/print.png" />
			<div class="buys">
				<div class="model">
					<span>型号</span>
					<input type="button" value="${modelinput}" disabled class="modelinput"/>
				</div>
				<div class="kinds">
					<span>类型</span>
					<input type="button" value="${kindsInput}" disabled class="kindsInput">
				</div>

			</div>
			<div class="buy_a">
				<span>购买数量</span>
				<div class="count">
			        <input id="text_box2" name="" type="text" value="${totalCount}"/>
				</div>
			</div>
		        
			<div class="buy_a">
				<span>应付金额</span>
				<span class="money">${totalPrice}</span>
			</div>
			<div class="takeaddress">
					<span>收货地址</span>
					<input type="text" value="${address}" class="Addadress" disabled/>
				</div>
			<input type="button" value="确认支付" class="confirm_pay"  onclick="onBridgeReady()"/>
		</article>
		

  <script>



	  function onBridgeReady(){
		  WeixinJSBridge.invoke(
				  'getBrandWCPayRequest', {
					  "appId":"${appId}",     //公众号名称，由商户传入
					  "timeStamp":"${timeStamp}",         //时间戳，自1970年以来的秒数
					  "nonceStr":"${nonceStr}", //随机串
					  "package":"${packages}",
					  "signType":"MD5",         //微信签名方式：
					  "paySign":"${paySign}" //微信签名
				  },
				  function(res){
					  if(res.err_msg == "get_brand_wcpay_request:ok" ) {}     // 使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回    ok，但并不保证它绝对可靠。
				  }
		  );
	  }
	  if (typeof WeixinJSBridge == "undefined"){
		  if( document.addEventListener ){
			  document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
		  }else if (document.attachEvent){
			  document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
			  document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
		  }
	  }else{
		  onBridgeReady();
	  }



	  window.onload=setInterval(function(){

		  $.ajax({
			  url:"${ctx}/print/timedQuery?orderNo=${orderNo}",
			  cache:false,
			  type:'post',
			  async:false,
			  success:function(data){
				  var ui=data;
				  if(ui==1){
					  window.location.href="${ctx}/print/print_list";
				  }
			  }
		  })
 ,500});

	</script>
	</body>
</html>
